package cn.itsource.ymcc.exception;

import cn.itsource.ymcc.constants.ErrorCode;
import lombok.Data;

//全局异常
@Data
public class GlobleException extends RuntimeException{

    //错误码
    private ErrorCode errorCode;

    /**--------------------------------------------------------
     传一个错误信息给异常对象
     --------------------------------------------------------**/
    public GlobleException(String message){
        super(message);
    }

    /**--------------------------------------------------------
    传一个错误码的枚举给异常对象
     --------------------------------------------------------**/
    public GlobleException(ErrorCode errorCode){
        super(errorCode.getMessage());
        this.errorCode = errorCode;
    }
}
